/***************************************************************************
 *   Copyright (C) 2008 by Silvan Imsand <imsandli@gmail.com>              *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 3 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA            *
 ***************************************************************************/

package com.sametime.twitterclient.views;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.IconAndMessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;

/**
 * 
* @since 1.0
* @author Silvan Imsand
*/
public class TwitterStatusDialog extends IconAndMessageDialog {

	  // The image
	  private Image image;

	  /**
	   * Constructor
	   * 
	   * @param parent the parent shell
	   */
	  public TwitterStatusDialog(Shell parent, Image img) {
	    super(parent);
	    setShellStyle( SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
	    this.image=img;
	  }

	  /**
	   * Set the message
	   * 
	   * @param message the message
	   */
	  public void setMessage(String message) {
	    this.message = message;
	  }

	  /* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#close()
	 */
	public boolean close() {
	    return super.close();
	  }

	  /* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite)
	 */
	protected Control createDialogArea(Composite parent) {
	    return createMessageArea(parent);
	  }

	  /* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite)
	 */
	protected void createButtonsForButtonBar(Composite parent) {
	    createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
	        false);
	  }

	  /* (non-Javadoc)
	 * @see org.eclipse.jface.dialogs.Dialog#buttonPressed(int)
	 */
	protected void buttonPressed(int buttonId) {
	    if (buttonId == IDialogConstants.CLOSE_ID) {
	      close();
	    }
	  }

	  /**
	   * return the image
	   */
	  protected Image getImage() {
	    return image;
	  }
	  
	  /* (non-Javadoc)
	 * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell)
	 */
	protected void configureShell( final Shell shell ) {
		    super.configureShell( shell );
		    shell.setText("Twitter Status");
	  }
	  
}